<template>
    <div id="reportList">
        <div class="reportList_content">
            <h3 class="reportList_title">简报列表</h3>
            <el-button class="createBrief" @click="createReport">新建简报</el-button>
            <div class="tableBox">
                <el-table
                    :data="tableData"
                    border
                    class="sentimentTable"
                    style="width: 100%">
                    <el-table-column
                    prop="bulletinName"
                    label="简报名称">
                    </el-table-column>
                    <el-table-column
                    prop="createTime"
                    label="生成时间">
                    </el-table-column>
                    <el-table-column
                    label="操作">
                    <template slot-scope>
                        <span class="tableBtn expot">导出</span>
                        <span class="tableBtn delete">删除</span>
                        <span class="tableBtn edit">编辑</span>
                    </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                    @size-change="handleSizeChange"
                    background
                    @current-change="handleCurrentChange"
                    :current-page="page.currentPage"
                    :page-sizes="page.pageSize"
                    :page-size="page.size"
                    layout="total, sizes, prev, pager, next"
                    :total="page.total"
                >
                </el-pagination>
            </div>
        </div>
    </div>
</template>
<script>
import '../../assets/css/reportList.css'
export default {
    data(){
        return{
            tableData: [],
            page: {
                currentPage: 1,
                pageSize: [10, 20, 30, 50],
                size: 10,
                total: 100
            }
        }
    },
    created(){
        this.getTableList()
    },
    methods:{
        createReport(){
            this.$router.push({path: '/sucaiList'})
        },
        handleSizeChange(val){
            this.page.size = val;
            this.getTableList();
        },
        handleCurrentChange(val){
            this.page.currentPage = val;
            this.page.size = 1;
            this.getTableList();
        },
        getTableList(){
            let param = {};
            param.pageNum = this.page.currentPage;
            param.pageSize = this.page.size;
            this.$Api.bulletinList(param).then(res => {
                console.log(res);
                if(res.code == '200'){
                  this.page.total = res.total;
                  this.tableData = res.rows;
                }
            })
        }
    }
}
</script>